#ifndef __REDUCER_HPP__
#define __REDUCER_HPP__ 1

#include <string> 
#include <list>

using namespace std; 

class Reducer
{
private:
  int r;
  string crtkey; 
public:
  void setRid(int r);
  void setKey(string key);
  void emit(string result); 
  Reducer(); 
  virtual ~Reducer(); 
  virtual void reduce(const list<string>& values) = 0;
}; 

Reducer* createReducer(); 

#define REGISTER_REDUCER(USERCLS)		\
  Reducer* createReducer()			\
  {						\
    return (Reducer*)new USERCLS();		\
  }						

#endif
